//
//  NSLayoutConstraint+Extension.swift
//  DoctorEPlus
//
//  Created by 王林波 on 2020/10/27.
//

import Foundation
import UIKit
extension NSLayoutConstraint {
    
    @IBInspectable var adapterScreen: Bool {
        get {
            return true
        }
        set {
            if newValue {
                self.constant = self.constant.radius
            }
        }
    }
}


@inline(__always)
internal func _JCLayoutConstraintMake(_ item: AnyObject, _ attr1: NSLayoutConstraint.Attribute, _ related: NSLayoutConstraint.Relation, _ toItem: AnyObject? = nil, _ attr2: NSLayoutConstraint.Attribute = .notAnAttribute, _ constant: CGFloat = 0, priority: UILayoutPriority = UILayoutPriority(1000), multiplier: CGFloat = 1, output: UnsafeMutablePointer<NSLayoutConstraint?>? = nil) -> NSLayoutConstraint {
    
    if let view = item as? UIView {
        view.translatesAutoresizingMaskIntoConstraints = false
    }
    
    if let view = item as? UIView {
        view.translatesAutoresizingMaskIntoConstraints = false
    }
    
    let c = NSLayoutConstraint(item:item, attribute:attr1, relatedBy:related, toItem:toItem, attribute:attr2, multiplier:multiplier, constant:constant)
    c.priority = priority
    if output != nil {
        output?.pointee = c
    }
    
    return c
}
